package com.xiaoyu.client.ui.activity.main.mine.set_favorable;

import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

import com.techfansy.bottomDialog.BottomDialog;
import com.xiaoyu.client.R;
import com.xiaoyu.client.network.NetworkConstants;
import com.xiaoyu.client.network.NetworkManager;
import com.xiaoyu.commonlib.network.CommonHttpResponser;
import com.xiaoyu.commonlib.ui.base.BaseActivityWithTitle;
import com.xiaoyu.commonlib.ui.widget.ContainsEmojiEditText;
import com.xiaoyu.commonlib.utils.ToastUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @author jx
 * @date 创建时间 2018/10/15
 * @Description 意见反馈页面
 */
public class FeedBackActivity extends BaseActivityWithTitle {

    @BindView(R.id.activity_feed_back_edit)
    ContainsEmojiEditText mFeedback;

    @Override
    protected void loadContentView(ViewGroup parent) {
        setTitleText("意见反馈");
        View mView = LayoutInflater.from(this).inflate(R.layout.activity_feed_back, parent, true);
        ButterKnife.bind(this);

    }

    //确认按钮点击事件
    @OnClick(R.id.activity_feed_back_affirm)
    public void affirmClick() {
        if (TextUtils.isEmpty(mFeedback.getText().toString())) {
            ToastUtil.showToast(this, "请输入意见反馈");
        } else {
            feedBack();//调取反馈意见接口
        }
    }

    private void feedBack() {
        NetworkManager.feedBack(mFeedback.getText().toString(), new CommonHttpResponser() {
            @Override
            public void onSuccess(String result) {
                ToastUtil.showToast(FeedBackActivity.this, "反馈成功");
                finish();
            }

            @Override
            public void onFailed(String errorCode, String errorDiscription) {
            }
        });
    }
}
